package com.ling.consumer;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import org.apache.rocketmq.spring.annotation.MessageModel;

/**
 * @author ling007
 * @date 2024/6/11 17:57
 * @desciption: 消费者
 */
@RocketMQMessageListener(topic = "sendMessage_topic",
    consumerGroup = "consumer-group-test1",
        messageModel = MessageModel.CLUSTERING
)
@Component
public class DemoConsumer1 implements RocketMQListener<String> {
    @Override
    public void onMessage(String s) {
        System.out.println("receive message1:" + s);
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("处理完成");
    }
}
